package com.example.film.controller;

import com.example.film.entity.TheaterWeekSell;
import com.example.film.service.TheaterWeekSellService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags = "院线每周票房信息管理接口")
@CrossOrigin
@RestController
@RequestMapping("theaterWeek/v1")
public class TheaterWeekSellController {
    @Autowired
    private TheaterWeekSellService theaterWeekSellService;

    @ApiOperation("每周院线票房信息")
    @GetMapping("/theaterSell")
    public List<TheaterWeekSell> getTheaterWeekSell(){
        return theaterWeekSellService.findTheaterWeekSell();
    }

    @ApiOperation("分页查询每周院线票房信息")
    @GetMapping("/theater")
    public List<TheaterWeekSell> getTheaterWeekSellInfo(@RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "10") Integer pageSize){
        return theaterWeekSellService.findTheaterWeekSellInfo(pageNum, pageSize);
    }

    @ApiOperation("根据周数查询每周院线票房信息")
    @GetMapping("/week/{week}")
    public List<TheaterWeekSell> getTheaterWeekSellByWeek(@PathVariable Integer week){
        return theaterWeekSellService.findTheaterWeekSellByWeek(week);
    }
}
